const { readFile } = require('fs/promises')
const fs = require('fs')
const { resolve } = require('path')
const getConfig = require('./get-config.js')

const {input} = getConfig()
const Re = /(?<=class=").*?(?=")/g

const getClass = async (path)=>{
	let content = await readFile(path)
	let classContent = content.toString().match(Re)
	if (classContent) {
		let arrClassName = classContent.map(i => i.split(' ')).flat()
		return [...new Set(arrClassName)]
	} else {
		return []
	}

}

module.exports = getClass